﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Tetris game by team Coconut</title>

    <script src="shims/deepClone.js"></script>
    <script src="shims/ClassicalOop.js"></script>
    <script src="tetris.js"></script>
    <script src="Vector2D.js"></script>
    <script src="Block.js"></script>
    <script src="_FallingObject.js"></script>
    <script src="FallingL.js"></script>
    <script src="FallingZ.js"></script>
    <script src="FallingLine.js"></script>
    <script src="FallingSquare.js"></script>
    <script src="Earth.js"></script>
    <script src="CollisionType.js"></script>
    <script src="CollisionDetector.js"></script>

</head>
<body>
    <script>
        var earth = new tetris.Earth(4, 8);

        var sq = new tetris.FallingSquare();
        sq.moveTo(0, 6);
        earth.add(sq);

        sq = new tetris.FallingSquare();
        sq.moveTo(2, 5);
        earth.add(sq);

        sq = new tetris.FallingSquare();
        sq.moveTo(1, 3);
        earth.add(sq);

        sq = new tetris.FallingSquare();
        sq.moveTo(3, 7);
        console.log(earth.toString());
        console.log(sq.toString());

        logPrintCollisions();

        sq.moveTo(0, 0);
        sq.rotate();
        sq.rotate();
        console.log(earth.toString());
        console.log(sq.toString());

        logPrintCollisions();

        function logPrintCollisions() {
            var collider = new tetris.CollisionDetector();
            var collisions = collider.getCollisions(sq, earth);

            if (collisions[tetris.CollisionType.Earth]) {
                console.log("Earth collision");
            }
            else {
                console.log("NO Earth collision");
            }

            if (collisions[tetris.CollisionType.TopEdge]) {
                console.log("Top edge collision");
            }
            else {
                console.log("NO Top edge collision");
            }

            if (collisions[tetris.CollisionType.LeftEdge]) {
                console.log("Left edge collision");
            }
            else {
                console.log("NO Left edge collision");
            }

            if (collisions[tetris.CollisionType.RightEdge]) {
                console.log("Right edge collision");
            }
            else {
                console.log("NO Right edge collision");
            }
        }
    </script>
</body>
</html>
